package com.jiawa.wiki.utils;

/**
 * 线程本地变量上下文
 * 如：在接口入口获取ip,并给线程本地变量赋值
 *    在service层，获取值
 */
public class RequestContext {

    private static ThreadLocal<String> remoteAddr = new ThreadLocal<>();

    public static String getRemoteAddr() {
        return remoteAddr.get();
    }

    public static void setRemoteAddr(String remoteAddr) {
        RequestContext.remoteAddr.set(remoteAddr);
    }
}
